<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('操作员管理')"/>
</head>
<body class="gray-bg">

     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								关键字：<input type="text" placeholder="姓名/卡号/员工号" name="keyWords"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:operator:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:operator:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:cellInfo:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:operator:export">
					<i class="fa fa-download"></i> 导出
            	</a>
				<a class="btn btn-primary" onclick="$.table.print()">
					<i class="fa fa-plus"></i> 打印
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true" style="white-space: nowrap"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:operator:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:operator:remove')}]];
        var prefix = ctx + "system/operator";

        $(function () {
            var options = {
                url: prefix + "/findList",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove/{id}",
				exportUrl: prefix + "/export",
                modalName: "操作员数据",
		        showExport: false,
                columns: [
					{
						checkbox: true
					},
					{
						field: 'operatorId',
						title: 'id',
						align: 'center',
						visible: false
					},
					{
						field: 'operatorName',
						title: '姓名',
						align: 'center',
						visible: true
					},
					{
						field: 'operatorCard',
						title: '卡号',
						align: 'center',
						visible: true
					},
					{
						field: 'empNo',
						title: '员工号',
						align: 'center',
						visible: true
					},
					{
						field: 'autoverifyPermission',
						title: '初始化权限',
						align: 'center',
						visible: true,
						formatter: function(value, row, index){
							if(value === 1){
								return "无"
							}else if(value === 2){
								return "有";
							}
						}
					},
					{
						field: 'checkPermission',
						title: 'IQC检验权限',
						align: 'center',
						visible: true,
						formatter: function(value, row, index){
							if(value === 1){
								return "无"
							}else if(value === 2){
								return "有";
							}
						}
					},
					// {
					// 	field: 'combinePermission',
					// 	title: '合框权限',
					// 	align: 'center',
					// 	visible: true,
					// 	formatter: function(value, row, index){
					// 		if(value === 1){
					// 			return "无"
					// 		}else if(value === 2){
					// 			return "有";
					// 		}
					// 	}
					// },
					{
						field: 'returnItemPermission',
						title: '退货权限',
						align: 'center',
						visible: true,
						formatter: function(value, row, index){
							if(value === 1){
								return "无"
							}else if(value === 2){
								return "有";
							}
						}
					},
					{
						field: 'qualityCheckPermission',
						title: '品质异常检验权限',
						align: 'center',
						visible: true,
						formatter: function(value, row, index){
							if(value === 1){
								return "无"
							}else if(value === 2){
								return "有";
							}
						}
					},
					{
						field: 'scrapPermission',
						title: '报废权限',
						align: 'center',
						visible: true,
						formatter: function(value, row, index){
							if(value === 1){
								return "无"
							}else if(value === 2){
								return "有";
							}
						}
					},
					{
						field: 'manualOutPermission',
						title: '非工单出库权限',
						align: 'center',
						visible: true,
						formatter: function(value, row, index){
							if(value === 1){
								return "无"
							}else if(value === 2){
								return "有";
							}
						}
					},
					// {
					// 	field: 'transferWarehousePermission',
					// 	title: '子库转移权限',
					// 	align: 'center',
					// 	visible: true,
					// 	formatter: function(value, row, index){
					// 		if(value === 1){
					// 			return "无"
					// 		}else if(value === 2){
					// 			return "有";
					// 		}
					// 	}
					// },
					{
						title: '操作',
						align: 'center',
						formatter: function(value, row, index){
							var actions = [];
							actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.operatorId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
							actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.operatorId + '\')"><i class="fa fa-remove"></i>删除</a>');
							return actions.join('');
						}
					},
				]
			};
			$.table.init(options);
		});
    </script>
</body>
</html>
